************* Do-file for: Study 2 Analysis         ****************
************* Date Modified: 09/09/2020             ****************
************* Created by: Adam D. Wolsky 	        ****************

clear
cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Analysis/Study2_Conyers/Data/"
use "study2_clean.dta"
set more off


/* download user-written command cibar; type "ssc install cibar"
   download user-written command cibar; type "ssc install outreg2" */

/* In analyzing the balance between the samples and summary statistics, I use 
"democrat_all" and "republican_all" which are dummy variables where strong, weak 
and leaners are coded as 1 and strong, weak, and leaning out-partisans and pure 
independents are coded as 0.  

In the analyses I use the dummy variable democrat or republican, which only include
partisans and leaners of the in-party and out-party, but exclude independents.  */


cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Analysis/Study2_Conyers/Logs/"

log using study2_log, replace name("Study 2 Log File")

********************************************************************************
**********************               Balance              **********************
********************************************************************************

mlogit expcond female edu black hisp asian age news dem_other_dummy rep_other_dummy, b(1)

********************************************************************************
**********************          Summary Statistics        **********************
********************************************************************************

summarize female high_ed age hisp black asian partisan dem_other_dummy rep_other_dummy

************************************   H1   ************************************

ttest demtherm if democrat == 1, by(t2vt1)

************************************   H2   ************************************

ttest demtherm if democrat == 1, by(t3vt2)

*********************************** Figure 2 ***********************************

cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Figures"

cibar demtherm if democrat == 1, level(90) over(expcond) ciopts(lcolor(black) ///
msize(0)) baropts(lcolor(black) lwidth(.2) barw(.7)) ///
graphopts(legend(off) xlabel(1 "Scandal" 2 "Hypocrisy" 3 "Resignation") ///
xtitle("Experimental Condition", margin(t=2)) ytitle("Mean of Democratic Party Thermometer") ///
yscale(range( 75)) ylabel(45(5)75) ysize(5) xsize(6))
graph export "fig2.pdf", replace as(pdf) 

************************************   H3   ************************************

ttest reptherm if republican == 1, by(t2vt1)

******************************     Footnote 9    *******************************

cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Analysis/Study1_Murphy/Data/"

* Create variable to indicate study number

gen study_no = .
replace study_no = 2

/* Merge Study 1 to compare how Democrats and Republicans evaluate their own party in the
scandal condition in the two studies. */

append using study1_clean.dta

replace study_no = 1 if missing(study_no)

/* First t-test compares thermometer ratings of the Republican Party among Republicans/Leaners
in the "scandal" condition for the two studies. Second t-test compares. */


ttest reptherm if republican == 1 & expcond == 1, by(study_no)
ttest demtherm if democrat == 1  & expcond == 1, by(study_no)

*********************************** Figure 4 ***********************************

cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Analysis/Study2_Conyers/Data/"

use "study2_clean.dta",clear

cd "/Users/adamwolsky/Dropbox/Vandy/Projects/Hypocrisy_Scandal/Figures"

cibar reptherm if republican == 1, level(90) over(t2vt1) ciopts(lcolor(black) ///
msize(0)) baropts(lcolor(black) lwidth(.2) barw(.7)) ///
graphopts(legend(off) xlabel(1 "Scandal" 2 "Hypocrisy") ///
xtitle("Experimental Condition", margin(t=2)) ytitle("Mean of Republican Party Thermometer") ///
yscale(range( 75)) ylabel(45(5)75) ysize(5) xsize(6))
graph export "fig4.pdf", replace as(pdf) 

********************************************************************************
**************************      Additional Tests       *************************
********************************************************************************

************************* Strength of Partisanship *****************************

* Extension of H1a/H1b

ttest demtherm if pid7 == 1, by(t2vt1)
ttest demtherm if pid7 == 2, by(t2vt1)
ttest demtherm if pid7 == 3, by(t2vt1)

* Extension of H2

ttest demtherm if pid7 == 1, by(t3vt2)
ttest demtherm if pid7 == 2, by(t3vt2)
ttest demtherm if pid7 == 3, by(t3vt2)

* Extension of H3

ttest reptherm if pid7 == 5, by(t2vt1)
ttest reptherm if pid7 == 6, by(t2vt1)
ttest reptherm if pid7 == 7, by(t2vt1)

***************************** News Consumption *********************************

* Extension of H1a/H1b

reg demtherm i.t2vt1##i.vclosenews if democrat == 1
margins, at(t2vt1=(0(1)1) vclosenews=(0(1)1)) level(90)

* Extension of H2

reg demtherm i.t3vt2##i.vclosenews if democrat == 1
margins, at(t3vt2=(0(1)1) vclosenews=(0(1)1)) level(90)

* Extension of H3

reg reptherm i.t2vt1##i.vclosenews if republican == 1
margins, at(t2vt1=(0(1)1) vclosenews=(0(1)1)) level(90)

log close _all
